﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using HYSoft.IDAL;
using Maticsoft.DBUtility;//Please add references
namespace HYSoft.SQLServerDAL
{
	/// <summary>
	/// 数据访问类:brd
	/// </summary>
	public partial class brd:Ibrd
	{
		public brd()
		{}
		#region  BasicMethod

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
		return DbHelperSQL.GetMaxID("m_brd_id", "brd"); 
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int m_brd_id)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from brd");
			strSql.Append(" where m_brd_id=@m_brd_id");
			SqlParameter[] parameters = {
					new SqlParameter("@m_brd_id", SqlDbType.Int,4)
			};
			parameters[0].Value = m_brd_id;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(HYSoft.Model.brd model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into brd(");
			strSql.Append("m_bs_id,m_brd_temperature,m_brd_batterystatus,m_brd_power,m_brd_powermode,m_brd_mac,m_brd_sid,m_brd_sensor_sum,m_brd_addr,m_brd_img,m_brd_sensor_type1,m_brd_sensor_type2,m_brd_sensor_type3,m_brd_sensor_type4,m_brd_sensor_type5,m_brd_sensor_type6,m_brd_sensor_type7,m_brd_sensor_type8,m_brd_stat,m_brd_sensor_stat1,m_brd_sensor_stat2,m_brd_sensor_stat3,m_brd_sensor_stat4,m_brd_sensor_stat5,m_brd_sensor_stat6,m_brd_sensor_stat7,m_brd_sensor_stat8,m_brd_x,m_brd_y)");
			strSql.Append(" values (");
			strSql.Append("@m_bs_id,@m_brd_temperature,@m_brd_batterystatus,@m_brd_power,@m_brd_powermode,@m_brd_mac,@m_brd_sid,@m_brd_sensor_sum,@m_brd_addr,@m_brd_img,@m_brd_sensor_type1,@m_brd_sensor_type2,@m_brd_sensor_type3,@m_brd_sensor_type4,@m_brd_sensor_type5,@m_brd_sensor_type6,@m_brd_sensor_type7,@m_brd_sensor_type8,@m_brd_stat,@m_brd_sensor_stat1,@m_brd_sensor_stat2,@m_brd_sensor_stat3,@m_brd_sensor_stat4,@m_brd_sensor_stat5,@m_brd_sensor_stat6,@m_brd_sensor_stat7,@m_brd_sensor_stat8,@m_brd_x,@m_brd_y)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@m_bs_id", SqlDbType.Int,4),
					new SqlParameter("@m_brd_temperature", SqlDbType.Int,4),
					new SqlParameter("@m_brd_batterystatus", SqlDbType.Int,4),
					new SqlParameter("@m_brd_power", SqlDbType.Int,4),
					new SqlParameter("@m_brd_powermode", SqlDbType.Int,4),
					new SqlParameter("@m_brd_mac", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sid", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_sum", SqlDbType.Int,4),
					new SqlParameter("@m_brd_addr", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_img", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type1", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type2", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type3", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type4", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type5", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type6", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type7", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type8", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_stat", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat1", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat2", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat3", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat4", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat5", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat6", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat7", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat8", SqlDbType.Int,4),
					new SqlParameter("@m_brd_x", SqlDbType.Int,4),
					new SqlParameter("@m_brd_y", SqlDbType.Int,4)};
			parameters[0].Value = model.m_bs_id;
			parameters[1].Value = model.m_brd_temperature;
			parameters[2].Value = model.m_brd_batterystatus;
			parameters[3].Value = model.m_brd_power;
			parameters[4].Value = model.m_brd_powermode;
			parameters[5].Value = model.m_brd_mac;
			parameters[6].Value = model.m_brd_sid;
			parameters[7].Value = model.m_brd_sensor_sum;
			parameters[8].Value = model.m_brd_addr;
			parameters[9].Value = model.m_brd_img;
			parameters[10].Value = model.m_brd_sensor_type1;
			parameters[11].Value = model.m_brd_sensor_type2;
			parameters[12].Value = model.m_brd_sensor_type3;
			parameters[13].Value = model.m_brd_sensor_type4;
			parameters[14].Value = model.m_brd_sensor_type5;
			parameters[15].Value = model.m_brd_sensor_type6;
			parameters[16].Value = model.m_brd_sensor_type7;
			parameters[17].Value = model.m_brd_sensor_type8;
			parameters[18].Value = model.m_brd_stat;
			parameters[19].Value = model.m_brd_sensor_stat1;
			parameters[20].Value = model.m_brd_sensor_stat2;
			parameters[21].Value = model.m_brd_sensor_stat3;
			parameters[22].Value = model.m_brd_sensor_stat4;
			parameters[23].Value = model.m_brd_sensor_stat5;
			parameters[24].Value = model.m_brd_sensor_stat6;
			parameters[25].Value = model.m_brd_sensor_stat7;
			parameters[26].Value = model.m_brd_sensor_stat8;
			parameters[27].Value = model.m_brd_x;
			parameters[28].Value = model.m_brd_y;

			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(HYSoft.Model.brd model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update brd set ");
			strSql.Append("m_bs_id=@m_bs_id,");
			strSql.Append("m_brd_temperature=@m_brd_temperature,");
			strSql.Append("m_brd_batterystatus=@m_brd_batterystatus,");
			strSql.Append("m_brd_power=@m_brd_power,");
			strSql.Append("m_brd_powermode=@m_brd_powermode,");
			strSql.Append("m_brd_mac=@m_brd_mac,");
			strSql.Append("m_brd_sid=@m_brd_sid,");
			strSql.Append("m_brd_sensor_sum=@m_brd_sensor_sum,");
			strSql.Append("m_brd_addr=@m_brd_addr,");
			strSql.Append("m_brd_img=@m_brd_img,");
			strSql.Append("m_brd_sensor_type1=@m_brd_sensor_type1,");
			strSql.Append("m_brd_sensor_type2=@m_brd_sensor_type2,");
			strSql.Append("m_brd_sensor_type3=@m_brd_sensor_type3,");
			strSql.Append("m_brd_sensor_type4=@m_brd_sensor_type4,");
			strSql.Append("m_brd_sensor_type5=@m_brd_sensor_type5,");
			strSql.Append("m_brd_sensor_type6=@m_brd_sensor_type6,");
			strSql.Append("m_brd_sensor_type7=@m_brd_sensor_type7,");
			strSql.Append("m_brd_sensor_type8=@m_brd_sensor_type8,");
			strSql.Append("m_brd_stat=@m_brd_stat,");
			strSql.Append("m_brd_sensor_stat1=@m_brd_sensor_stat1,");
			strSql.Append("m_brd_sensor_stat2=@m_brd_sensor_stat2,");
			strSql.Append("m_brd_sensor_stat3=@m_brd_sensor_stat3,");
			strSql.Append("m_brd_sensor_stat4=@m_brd_sensor_stat4,");
			strSql.Append("m_brd_sensor_stat5=@m_brd_sensor_stat5,");
			strSql.Append("m_brd_sensor_stat6=@m_brd_sensor_stat6,");
			strSql.Append("m_brd_sensor_stat7=@m_brd_sensor_stat7,");
			strSql.Append("m_brd_sensor_stat8=@m_brd_sensor_stat8,");
			strSql.Append("m_brd_x=@m_brd_x,");
			strSql.Append("m_brd_y=@m_brd_y");
			strSql.Append(" where m_brd_id=@m_brd_id");
			SqlParameter[] parameters = {
					new SqlParameter("@m_bs_id", SqlDbType.Int,4),
					new SqlParameter("@m_brd_temperature", SqlDbType.Int,4),
					new SqlParameter("@m_brd_batterystatus", SqlDbType.Int,4),
					new SqlParameter("@m_brd_power", SqlDbType.Int,4),
					new SqlParameter("@m_brd_powermode", SqlDbType.Int,4),
					new SqlParameter("@m_brd_mac", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sid", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_sum", SqlDbType.Int,4),
					new SqlParameter("@m_brd_addr", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_img", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type1", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type2", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type3", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type4", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type5", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type6", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type7", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_sensor_type8", SqlDbType.VarChar,255),
					new SqlParameter("@m_brd_stat", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat1", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat2", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat3", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat4", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat5", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat6", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat7", SqlDbType.Int,4),
					new SqlParameter("@m_brd_sensor_stat8", SqlDbType.Int,4),
					new SqlParameter("@m_brd_x", SqlDbType.Int,4),
					new SqlParameter("@m_brd_y", SqlDbType.Int,4),
					new SqlParameter("@m_brd_id", SqlDbType.Int,4)};
			parameters[0].Value = model.m_bs_id;
			parameters[1].Value = model.m_brd_temperature;
			parameters[2].Value = model.m_brd_batterystatus;
			parameters[3].Value = model.m_brd_power;
			parameters[4].Value = model.m_brd_powermode;
			parameters[5].Value = model.m_brd_mac;
			parameters[6].Value = model.m_brd_sid;
			parameters[7].Value = model.m_brd_sensor_sum;
			parameters[8].Value = model.m_brd_addr;
			parameters[9].Value = model.m_brd_img;
			parameters[10].Value = model.m_brd_sensor_type1;
			parameters[11].Value = model.m_brd_sensor_type2;
			parameters[12].Value = model.m_brd_sensor_type3;
			parameters[13].Value = model.m_brd_sensor_type4;
			parameters[14].Value = model.m_brd_sensor_type5;
			parameters[15].Value = model.m_brd_sensor_type6;
			parameters[16].Value = model.m_brd_sensor_type7;
			parameters[17].Value = model.m_brd_sensor_type8;
			parameters[18].Value = model.m_brd_stat;
			parameters[19].Value = model.m_brd_sensor_stat1;
			parameters[20].Value = model.m_brd_sensor_stat2;
			parameters[21].Value = model.m_brd_sensor_stat3;
			parameters[22].Value = model.m_brd_sensor_stat4;
			parameters[23].Value = model.m_brd_sensor_stat5;
			parameters[24].Value = model.m_brd_sensor_stat6;
			parameters[25].Value = model.m_brd_sensor_stat7;
			parameters[26].Value = model.m_brd_sensor_stat8;
			parameters[27].Value = model.m_brd_x;
			parameters[28].Value = model.m_brd_y;
			parameters[29].Value = model.m_brd_id;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int m_brd_id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from brd ");
			strSql.Append(" where m_brd_id=@m_brd_id");
			SqlParameter[] parameters = {
					new SqlParameter("@m_brd_id", SqlDbType.Int,4)
			};
			parameters[0].Value = m_brd_id;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string m_brd_idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from brd ");
			strSql.Append(" where m_brd_id in ("+m_brd_idlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public HYSoft.Model.brd GetModel(int m_brd_id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 m_brd_id,m_bs_id,m_brd_temperature,m_brd_batterystatus,m_brd_power,m_brd_powermode,m_brd_mac,m_brd_sid,m_brd_sensor_sum,m_brd_addr,m_brd_img,m_brd_sensor_type1,m_brd_sensor_type2,m_brd_sensor_type3,m_brd_sensor_type4,m_brd_sensor_type5,m_brd_sensor_type6,m_brd_sensor_type7,m_brd_sensor_type8,m_brd_stat,m_brd_sensor_stat1,m_brd_sensor_stat2,m_brd_sensor_stat3,m_brd_sensor_stat4,m_brd_sensor_stat5,m_brd_sensor_stat6,m_brd_sensor_stat7,m_brd_sensor_stat8,m_brd_x,m_brd_y from brd ");
			strSql.Append(" where m_brd_id=@m_brd_id");
			SqlParameter[] parameters = {
					new SqlParameter("@m_brd_id", SqlDbType.Int,4)
			};
			parameters[0].Value = m_brd_id;

			HYSoft.Model.brd model=new HYSoft.Model.brd();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public HYSoft.Model.brd DataRowToModel(DataRow row)
		{
			HYSoft.Model.brd model=new HYSoft.Model.brd();
			if (row != null)
			{
				if(row["m_brd_id"]!=null && row["m_brd_id"].ToString()!="")
				{
					model.m_brd_id=int.Parse(row["m_brd_id"].ToString());
				}
				if(row["m_bs_id"]!=null && row["m_bs_id"].ToString()!="")
				{
					model.m_bs_id=int.Parse(row["m_bs_id"].ToString());
				}
				if(row["m_brd_temperature"]!=null && row["m_brd_temperature"].ToString()!="")
				{
					model.m_brd_temperature=int.Parse(row["m_brd_temperature"].ToString());
				}
				if(row["m_brd_batterystatus"]!=null && row["m_brd_batterystatus"].ToString()!="")
				{
					model.m_brd_batterystatus=int.Parse(row["m_brd_batterystatus"].ToString());
				}
				if(row["m_brd_power"]!=null && row["m_brd_power"].ToString()!="")
				{
					model.m_brd_power=int.Parse(row["m_brd_power"].ToString());
				}
				if(row["m_brd_powermode"]!=null && row["m_brd_powermode"].ToString()!="")
				{
					model.m_brd_powermode=int.Parse(row["m_brd_powermode"].ToString());
				}
				if(row["m_brd_mac"]!=null && row["m_brd_mac"].ToString()!="")
				{
					model.m_brd_mac=int.Parse(row["m_brd_mac"].ToString());
				}
				if(row["m_brd_sid"]!=null && row["m_brd_sid"].ToString()!="")
				{
					model.m_brd_sid=int.Parse(row["m_brd_sid"].ToString());
				}
				if(row["m_brd_sensor_sum"]!=null && row["m_brd_sensor_sum"].ToString()!="")
				{
					model.m_brd_sensor_sum=int.Parse(row["m_brd_sensor_sum"].ToString());
				}
				if(row["m_brd_addr"]!=null)
				{
					model.m_brd_addr=row["m_brd_addr"].ToString();
				}
				if(row["m_brd_img"]!=null)
				{
					model.m_brd_img=row["m_brd_img"].ToString();
				}
				if(row["m_brd_sensor_type1"]!=null)
				{
					model.m_brd_sensor_type1=row["m_brd_sensor_type1"].ToString();
				}
				if(row["m_brd_sensor_type2"]!=null)
				{
					model.m_brd_sensor_type2=row["m_brd_sensor_type2"].ToString();
				}
				if(row["m_brd_sensor_type3"]!=null)
				{
					model.m_brd_sensor_type3=row["m_brd_sensor_type3"].ToString();
				}
				if(row["m_brd_sensor_type4"]!=null)
				{
					model.m_brd_sensor_type4=row["m_brd_sensor_type4"].ToString();
				}
				if(row["m_brd_sensor_type5"]!=null)
				{
					model.m_brd_sensor_type5=row["m_brd_sensor_type5"].ToString();
				}
				if(row["m_brd_sensor_type6"]!=null)
				{
					model.m_brd_sensor_type6=row["m_brd_sensor_type6"].ToString();
				}
				if(row["m_brd_sensor_type7"]!=null)
				{
					model.m_brd_sensor_type7=row["m_brd_sensor_type7"].ToString();
				}
				if(row["m_brd_sensor_type8"]!=null)
				{
					model.m_brd_sensor_type8=row["m_brd_sensor_type8"].ToString();
				}
				if(row["m_brd_stat"]!=null && row["m_brd_stat"].ToString()!="")
				{
					model.m_brd_stat=int.Parse(row["m_brd_stat"].ToString());
				}
				if(row["m_brd_sensor_stat1"]!=null && row["m_brd_sensor_stat1"].ToString()!="")
				{
					model.m_brd_sensor_stat1=int.Parse(row["m_brd_sensor_stat1"].ToString());
				}
				if(row["m_brd_sensor_stat2"]!=null && row["m_brd_sensor_stat2"].ToString()!="")
				{
					model.m_brd_sensor_stat2=int.Parse(row["m_brd_sensor_stat2"].ToString());
				}
				if(row["m_brd_sensor_stat3"]!=null && row["m_brd_sensor_stat3"].ToString()!="")
				{
					model.m_brd_sensor_stat3=int.Parse(row["m_brd_sensor_stat3"].ToString());
				}
				if(row["m_brd_sensor_stat4"]!=null && row["m_brd_sensor_stat4"].ToString()!="")
				{
					model.m_brd_sensor_stat4=int.Parse(row["m_brd_sensor_stat4"].ToString());
				}
				if(row["m_brd_sensor_stat5"]!=null && row["m_brd_sensor_stat5"].ToString()!="")
				{
					model.m_brd_sensor_stat5=int.Parse(row["m_brd_sensor_stat5"].ToString());
				}
				if(row["m_brd_sensor_stat6"]!=null && row["m_brd_sensor_stat6"].ToString()!="")
				{
					model.m_brd_sensor_stat6=int.Parse(row["m_brd_sensor_stat6"].ToString());
				}
				if(row["m_brd_sensor_stat7"]!=null && row["m_brd_sensor_stat7"].ToString()!="")
				{
					model.m_brd_sensor_stat7=int.Parse(row["m_brd_sensor_stat7"].ToString());
				}
				if(row["m_brd_sensor_stat8"]!=null && row["m_brd_sensor_stat8"].ToString()!="")
				{
					model.m_brd_sensor_stat8=int.Parse(row["m_brd_sensor_stat8"].ToString());
				}
				if(row["m_brd_x"]!=null && row["m_brd_x"].ToString()!="")
				{
					model.m_brd_x=int.Parse(row["m_brd_x"].ToString());
				}
				if(row["m_brd_y"]!=null && row["m_brd_y"].ToString()!="")
				{
					model.m_brd_y=int.Parse(row["m_brd_y"].ToString());
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select m_brd_id,m_bs_id,m_brd_temperature,m_brd_batterystatus,m_brd_power,m_brd_powermode,m_brd_mac,m_brd_sid,m_brd_sensor_sum,m_brd_addr,m_brd_img,m_brd_sensor_type1,m_brd_sensor_type2,m_brd_sensor_type3,m_brd_sensor_type4,m_brd_sensor_type5,m_brd_sensor_type6,m_brd_sensor_type7,m_brd_sensor_type8,m_brd_stat,m_brd_sensor_stat1,m_brd_sensor_stat2,m_brd_sensor_stat3,m_brd_sensor_stat4,m_brd_sensor_stat5,m_brd_sensor_stat6,m_brd_sensor_stat7,m_brd_sensor_stat8,m_brd_x,m_brd_y ");
			strSql.Append(" FROM brd ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" m_brd_id,m_bs_id,m_brd_temperature,m_brd_batterystatus,m_brd_power,m_brd_powermode,m_brd_mac,m_brd_sid,m_brd_sensor_sum,m_brd_addr,m_brd_img,m_brd_sensor_type1,m_brd_sensor_type2,m_brd_sensor_type3,m_brd_sensor_type4,m_brd_sensor_type5,m_brd_sensor_type6,m_brd_sensor_type7,m_brd_sensor_type8,m_brd_stat,m_brd_sensor_stat1,m_brd_sensor_stat2,m_brd_sensor_stat3,m_brd_sensor_stat4,m_brd_sensor_stat5,m_brd_sensor_stat6,m_brd_sensor_stat7,m_brd_sensor_stat8,m_brd_x,m_brd_y ");
			strSql.Append(" FROM brd ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM brd ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.m_brd_id desc");
			}
			strSql.Append(")AS Row, T.*  from brd T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "brd";
			parameters[1].Value = "m_brd_id";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod

		#endregion  ExtensionMethod
	}
}

